import React from 'react'

// import { BrowserRouter as Router, Switch, Route } from "react-router-dom";

import { HashRouter as Router, Switch, Route, Redirect } from "react-router-dom";

import NavLinks from './components/NavLinks'

import Mine from './pages/Mine'
import Home from './pages/Home'
import Admin from './pages/Admin'
import NotFound from './pages/NotFound'

import  List from './pages/List'


import  News from './pages/News'


import  Books from './pages/Books'


import  Playing  from './pages/Playing'



import  Parent from './pages/Parent'


import  Child1  from './pages/child/Child1'
import  Child2  from './pages/child/Child2'

export default class App extends React.Component {
    render() {

        return (
            <div>
                <h2>App组件</h2>
                {/* react  路由   */}
                <Router>
                    <NavLinks></NavLinks>
                     {/* <Route  path='路径' component={组件的名字}></Route> */}                  
                     {/* exact   只显示对应的 
                     strict   严格模式 */}
                     <Switch>
                            {/*  重定向 建议加在第一行 */}
                            <Redirect  from='/myhome'   to ='/home' ></Redirect>
                            <Route  exact     strict           path='/'     component={Admin}></Route>
                            <Route  exact    strict     path='/mine'  component={Mine}></Route>
                            <Route  exact    strict     path='/home'  component={Home}></Route>
                          
                            <Route  exact    strict     path='/list/:id/:name'  component={List}></Route>
                            <Route     exact    strict       path='/news'  component={News}></Route>
                            <Route     exact    strict       path='/books'  component={Books}></Route>
                          
                            
                            <Parent>
                            <Redirect  from='/parent'   to ='/parent/child1' ></Redirect>
                            <Route     exact    strict       path='/parent/child1'  component={Child1}></Route>
                            <Route     exact    strict       path='/parent/child2'  component={Child2}></Route>
                               

                           

                            </Parent>
                            
                            
                            
                            
                            {/*  Route  不能有一个空格  */}
                            {/*  <Route  exact    strict     path='/home' component={Home}>   </Route> */}
                            {/*  404 啥都不写  而且只能写在路由的最后 */}

                            <Route   component={NotFound}></Route>
                    </Switch>


                      {/* 非路由组件 */}
                    {/* <Playing></Playing> */}
                </Router>
            
            
            
            
            

           
            </div>
        )
    }
}